package com.cskaoyan.dbutils;

import com.cskaoyan.bean.Account;
import com.cskaoyan.datasource.DruidUtils;
import com.cskaoyan.resultset.MyResultSetHandler;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 创建日期: 2022/07/02 10:19
 *
 * @author ciggar
 *
 * query
 */
public class QueryRunnerDemo2 {


    public static void main(String[] args) throws SQLException {

        // 创建QueryRunner
        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());


        // 执行查询语句
        Account account = queryRunner.query("select * from account where id = ?", new MyResultSetHandler(), 3);


        System.out.println(account);


    }
}
